//
//  UIView+Chained.m
//  ObjectCChained
//
//  Created by sny on 2018/5/18.
//  Copyright © 2018年 HuangYangYang. All rights reserved.
//

#import "UIView+Chained.h"

@implementation UIView (Chained)

- (UIView *(^)(CGRect))chainedFrame {
    return ^UIView *(CGRect rect){
        self.frame = rect;
        return self;
    };
}

- (UIView *(^)(UIColor *))chainedblackGroundColor {
    return ^UIView *(UIColor *blackGroundColor) {
        if (blackGroundColor) {self.backgroundColor = blackGroundColor;}
        return self;
    };
}

- (UIView *(^)(CGFloat,BOOL))chainedLayerCircular {
    return ^UIView *(CGFloat cornerRadius,BOOL masksToBounds) {
        if (cornerRadius) {self.layer.cornerRadius = cornerRadius;}
        if (masksToBounds) {self.layer.masksToBounds = masksToBounds;}
        return self;
    };
}

- (UIView *(^)(UIColor *,CGFloat ))chainedLayerBorder {
    return ^UIView *(UIColor *color,CGFloat borderWidth) {
        if (color) {self.layer.borderColor = color.CGColor;}
        if (borderWidth) {self.layer.borderWidth = borderWidth;}
        return self;
    };
}

- (UIView *(^)(BOOL))chaindeUIViewHidden {
    return ^UIView *(BOOL hidden) {
        self.hidden = hidden;
        return self;
    };
}

- (UIView *(^)(NSInteger))chaindeUIViewTag {
    return ^UIView *(NSInteger tag) {
        self.tag = tag;
        return self;
    };
}

- (UIView *(^)(CGFloat))chaindeUIViewAlpha {
    return ^UIView *(CGFloat alpha) {
        self.alpha = alpha;
        return self;
    };
}

- (UIView *(^)(BOOL))chaindeUIViewClipsToBounds {
    return ^UIView *(BOOL clipsToBounds) {
        self.clipsToBounds = clipsToBounds;
        return self;
    };
}

#pragma mark - setter

- (void)setChainedFrame:(UIView *(^)(CGRect))chainedFrame {}

- (void)setChainedblackGroundColor:(UIView *(^)(UIColor *))chainedblackGroundColor {}

- (void)setChainedLayerBorder:(UIView *(^)(UIColor *, CGFloat))chainedLayerBorder {}

- (void)setChainedLayerCircular:(UIView *(^)(CGFloat, BOOL))chainedLayerCircular {}

- (void)setChaindeUIViewAlpha:(UIView *(^)(CGFloat))chaindeUIViewAlpha {}

- (void)setChaindeUIViewHidden:(UIView *(^)(BOOL))chaindeUIViewHidden {}

- (void)setChaindeUIViewClipsToBounds:(UIView *(^)(BOOL))chaindeUIViewClipsToBounds {}

- (void)setChaindeUIViewTag:(UIView *(^)(NSInteger))chaindeUIViewTag {}

@end
